import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/views/login')), 'login');
const home = r => require.ensure([], () => r(require('@/views/index/index')), 'index');
const product = r => require.ensure([], () => r(require('@/views/product/index')), 'product');

const routes = [
  {
    path: '/login',
    component: login,
    name:'login'
  },

  {
    path: '/',
    component: () =>
        import ('@/views/home'),
    name: 'home',
    children: [
    ,{
      path: 'home',
      name:'home',
      component: () =>
          import ('@/views/index/index'),
      meta: [],
    },
      {
        path: 'product',
        name: 'product',
        component: () =>
            import ('@/views/product/index'),
        meta: { title: '产品列表' }
      },
      {
        path: 'categray',
        name: 'categray',
        component: () =>
            import ('@/views/product/categray'),
        meta: { title: '产品分类' }
      },
      {
        path: 'unit',
        name:'unit',

        component: () =>
            import ('@/views/other/unit'),
            meta: { title: '计量单位' }
      },
      {
        path: 'cust',
        name:'cust',

        component: () =>
            import ('@/views/cust'),
            meta: { title: '客户管理' }
      },
      {
        path: 'craft',
        name:'craft',

        component: () =>
            import ('@/views/craft'),
            meta: { title: '供应商管理' }
      },
      {
        path: 'work',
        name:'work',

        component: () =>
            import ('@/views/work'),
            meta: { title: '生产面板' }
      },
      {
        path: 'tech',
        name:'tech',

        component: () =>
            import ('@/views/tech'),
            meta: { title: '工艺管理' }
      },
      {
        path: 'cost',
        name:'cost',

        component: () =>
            import ('@/views/cost'),
            meta: { title: '加工单价' }
      },
      {
        path: 'store',
        name:'store',

        component: () =>
            import ('@/views/store'),
            meta: { title: '仓库管理' }
      },
      {
        path: 'storeList',
        name:'storeList',

        component: () =>
            import ('@/views/storeList'),
            meta: { title: '库存管理' }
      },
      {
        path: 'storeInsert',
        name:'storeInsert',
        component: () =>
            import ('@/views/storeList/insert'),
            meta: { title: '入库单' }
      },
      {
        path: 'outstore',
        name:'outstore',
        component: () =>
            import ('@/views/storeList/outstore'),
            meta: { title: '出库单' }
      },
      {
        path: 'position',
        name:'position',

        component: () =>
            import ('@/views/other/position'),
            meta: { title: '职位管理' }
      },
      {
        path: 'depart',
        name:'depart',
        component: () =>
            import ('@/views/other/depart'),
            meta: { title: '部门管理' }
      },
      {
        path: 'staff',
        name:'staff',
        component: () =>
            import ('@/views/staff/index'),
            meta: { title: '员工列表' }
      },
      {
        path: 'work',
        name:'work',
        component: () =>
            import ('@/views/staff/work'),
            meta: { title: '考勤管理' }
      },
      {
        path: 'salary',
        name:'salary',
        component: () =>
            import ('@/views/staff/salary'),
            meta: { title: '工资薪酬' }
      },
    ]
  }
]

export default new Router({
  mode:'history',
  routes,
  // strict: process.env.NODE_ENV !== 'production',
})
